<?php
//register_shutdown_function('send_attachment');
//echo "The mail had sent";
// no prefix
// works only in PHP 5 and later versions
$token = strtoupper(md5(uniqid()));
echo $token."<br>";
// better, difficult to guess
$better_token = strtoupper(md5(uniqid(rand(),true)));
echo $better_token."<br>";
$path = '/var/www/vhosts/digitalpickle.com/httpdocs/customerTesting/tp1.jpg';
$filename = 'Gift-Certificate.pdf';
// Create attached file name
if(strlen($filename) == 0){
    $filename = basename($path);
}
else{
    $path_parts = pathinfo($path);
    $filename = basename($filename,$path_parts['extension']).'.'.$path_parts['extension'];
    $filename = str_replace("..",".",$filename);
}
echo $filename."<br>";
exit;
function send_attachment(){
    // Include senmail library
    include("sendmail.class.php");

    // Create a new instance of class
    $mail = new sendmail();

    // Specify to use CharSet
    $mail->setCharset("ISO-8859-1");

    // Specify the sender and the sender's email address
    $mail->from("Phuc Ngo","phucngohoang@yahoo.com");

    // Specify the recipient's email address
    $mail->to("phucnh@Cybersoft-VN.com");

    // Specifying the Cc Recipients
    //$mail->cc("Email@Adresse.de");
    //$mail->cc("Email@Adresse.de");

    // Specifying the Bcc Recipients
    $mail->bcc("phucngohoang@gmail.com");
    //$mail->bcc("Email@Adresse.de");

    // Specify the subject
    $mail->subject("Test send mail with attachment - update 2");

    // Specify the text (HTML also possible)
    // When you enter the HTML text please omit <HTML> <BODY> </BODY> </HTML> tags,
    // since this is automatically added
    $mail->text("The text is sent with HTML tags<br/>The second line\nThe third line with");

    // Embed the attachments
    $mail->attachment("tpl1.jpg");

    // Send e-mail
    $mail->send();
}
?>